package com.hanserwei.community.enums;

import lombok.Getter;

/**
 * 响应状态码枚举
 * <p>
 * 建议按照业务模块进行划分，例如：
 * - 1xxx: 通用错误
 * - 2xxx: 用户模块错误
 * ...
 */
@Getter
public enum ResponseCodeEnum {

    // ========== 通用成功状态码 ==========
    SUCCESS(200, "操作成功"),

    // ========== 通用异常状态码 (1xxx) ==========
    SYSTEM_ERROR(1000, "系统繁忙，请稍后重试"),
    INVALID_PARAMETER(1001, "参数无效或缺失"),
    UNAUTHORIZED(1002, "未授权或凭证已过期"),
    FORBIDDEN_ACCESS(1003, "无权访问该资源"),
    RESOURCE_NOT_FOUND(1004, "请求的资源不存在"),

    // ========== 用户模块异常 (2xxx) ==========
    USER_NOT_FOUND(2000, "用户不存在"),
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_LOCKED(2002, "用户账户已被锁定"),
    USERNAME_ALREADY_EXISTS(2003, "该用户名已被注册"),
    USER_PASSWORD_ERROR(2004, "用户密码错误"),
    USER_ACCOUNT_ERROR(2005, "用户账户错误"),
    USER_CAPTCHA_ERROR(2006, "验证码错误");

    // ========== 自定义异常 (3xxx) ==========

    private final int code;
    private final String message;

    ResponseCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

}